<!--
/**
* Author: linchun
* Date: 2022-08-01 16:45
* Desc: CinemaChoose 影院选择
*/
-->
<template>
  <view v-if="cinemaInfo.cinemaId">
    <view @click="toCinemaChoose" v-if="fromHome === '1'" class="flex flex-m">
      <text class="name"> {{ cinemaInfo.cinemaName }} </text>
      <!-- <u-icon name="arrow-down-fill" class="icon-pick" size="12" color="#000" /> -->
      <image
        class="icon-pick"
        v-if="isSingleModel"
        mode="scaleToFill"
        :src="iconImage"
      ></image>
    </view>
    <view v-else class="flex-col-bottom flex style-open">
      <view class="flex-1">
        <view class="ellipsis fs32"> {{ cinemaInfo.cinemaName }}</view>
        <view class="fs26 mt15">{{ cinemaInfo.address }}</view>
      </view>
      <view class="change-btn" v-if="isSingleModel" @click="toCinemaChoose"
        >切换影院</view
      >
    </view>
  </view>
</template>

<script>
  import { ICON_ARROW_DOWN } from '@/model/imgConst.ts'
  import { mapGetters } from 'vuex'
  export default {
    name: 'CinemaChoose',
    data() {
      return {
        cinemaInfoData: {},
        iconImage: ICON_ARROW_DOWN
      }
    },
    props: {
      // info: {
      //   type: Object,
      //   default: () => {
      //     return {}
      //   }
      // },
      fromHome: {
        type: String,
        default: '1' // 1首页，2特惠
      }
    },
    computed: {
      ...mapGetters(['cinemaName', 'cinemaInfo']),
      isSingleModel() {
        // true 多影城  false 单影城
        return this.$auth.getSingleModel()
      }
    },
    mounted() {
      // this.init()
    },
    methods: {
      // 初始化方法
      // init() {
      //   if (!this.cinemaInfo.cinemaId) {
      //     this.cinemaInfoData = this.$auth.getCinemaInfo(true, 'save')
      //   } else {
      //     this.cinemaInfoData = this.cinemaInfo
      //   }
      // },
      toCinemaChoose() {
        if (this.isSingleModel) {
          const query = this.$utils.encode({
            fromHome: this.fromHome
          })
          this.$tools.navigateTo(
            `/subPages/selectFilm/selectFilm?query=${query}`
          )
        }
      }
    }
  }
</script>
<style lang="scss" scoped>
  .icon-pick {
    width: 18rpx;
    height: 15rpx;
    margin-left: 9rpx;
  }
  .style-open {
    color: #ffffff;
    .change-btn {
      height: 48rpx;
      line-height: 48rpx;
      padding: 0 20rpx;
      background: rgba(255, 255, 255, 0.15);
      border: 1px solid #ffffff;
      border-radius: 24rpx;
      color: #ffffff;
      font-size: 24rpx;
    }
  }
</style>
